package com.fafu.mybatis.demo.service;

import com.fafu.mybatis.demo.mapper.UserInfoMapper;
import com.fafu.mybatis.demo.modal.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserInfoMapper userInfoMapper;

    public List<UserInfo> selectUserList(){
        return userInfoMapper.selectAll();
    }

    public UserInfo selectUserByNameAndPassword(String userName,String password) {
        List<UserInfo> list = userInfoMapper.queryByUsernameAndPassword(userName,password);
        if(list.size() > 0){
            return list.get(0);
        }
        return null;
    }
}
